<?php 
$lang=$_REQUEST['lang'];
$nguoiguidi=$_REQUEST['nguoiguidi'];
$listid=$_REQUEST['listid'];
$company=$_REQUEST['company'];
$idpro=$_REQUEST['idpro'];
$idnf=$_REQUEST['idnf'];
$dfrom=$_REQUEST['dfrom'];
$nguoiquanly=$_REQUEST['nguoiquanly'];
$ngaybatdau=$_REQUEST['ngaybatdau'];
$trangthai=$_REQUEST['trangthai'];
$prname=$_REQUEST['prname'];
$prview=$_REQUEST['prview'];
$nforder='';
$nftitle='';
$nfcontent='';
$nfdate='';
if (empty($lang) || $lang == "EN") {
	$value = "value/value_en.php";
} else if($lang == "VN") {
	$value = "value/value_vn.php";
}
else {
	$value = "value/value_kr.php";
}
include($value);
$s1="SELECT nf.nf_title,nf.nf_content,nf.nf_createdate,nf.nf_order from pr_newfunction nf where nf.nfid='".$idnf."' and nf.pr_idproject='".$idpro."'";
$query="SELECT FullName,UserName,Email from employee WHERE employee.IDEmployee in (".$listid.")";
include 'connection.php';
set_time_limit(0);
$rs=mysql_query($s1);
while($r=mysql_fetch_array($rs)){
	$nforder=chop($r['nf_order']);
	$nftitle=chop(stripslashes($r['nf_title']));
	$nfcontent=chop(stripslashes($r['nf_content']));
	$nfdate=chop($r['nf_createdate']);
}
$mkq=mysql_query($query);
require_once('class.phpmailer.php');

		$mail = new PHPMailer();
		$mail->IsSMTP();
		$mail->SMTPDebug  = 2;                    
		$mail->SMTPAuth   = true;                  
		$mail->SMTPSecure = "ssl";
		$mail->Host       = "smtp.gmail.com";     
		$mail->Port       = 465;                     
		$mail->Username   = "elisoftmailserver@gmail.com"; 
		$mail->Password   = "1234567892727";    
		$mail->SetFrom('elisoftmailserver@gmail.com',$company);
		while($row=mysql_fetch_array($mkq)){
			$mail->AddAddress($row['Email'], $row['FullName']);
		}
		//$mail->AddAddress('senan_lotus@yahoo.com', $row['FullName']);
		$mail->Subject    =$l_newfewture.' ('.$prname.')'.' : '.$prview.'-'.$nforder.' ( '.$l_from.' ['.$dfrom.'] )';
		$mail->CharSet = "utf-8";
		$mail->IsHTML(true);
		$body ='<style type="text/css">';
		$body .='	* {padding:0;padding-left:5px;padding-right:5px; margin:0; list-style:none; border:none; font-family:Verdana,helvetica,arial,sans-serif; font-size:13px; text-decoration:none; line-height:22px;background:#f2f9ff}';
			$body .=' .maint {width:98%; margin:20px auto;}';
			$body .=' h3 {font-size:14px; color:#0064C8;padding-top:10px;}';	
			$body .=' p { padding-left:20px;background:white; }';
			$body .=' .titlet {font-weight:bold}';
			$body .=' .signt {float:right; padding-top:5px;color:green;}';
			$body .=' .cleart {clear:both}';
			$body .=' .viewndt {background:red;}';
		$body .='</style>';
		$body .='<div class="maint">';
			$body .='<h3>'.$l_project.' : '.$prname.' </h3>';
		    $body .='<p class="titlet"> - '.$l_start_date.' : '.$ngaybatdau.'</p>';
		    $body .='<p class="titlet"> - '.$l_manager.' : '.$nguoiquanly.'</p>';
		    $body .='<p class="titlet"> - '.$l_status.' : '.$trangthai.'</p>';
		    $body .='<div class="cleart"></div>';
		    $body .='<div class="cleart"></div>';
		    $body .='<h3>'.$l_newfewture.' : '.$prview.'-'.$nforder.' ('.$nfdate.')</h3>';
		    $body .='<p class="titlet"><span style="text-decoration:blink;color:green; background:white; font-size:13px">* </span>'.$l_title.' : '.$nftitle.'</p>';
		    $body .='<p class="titlet"><span style="color:green;text-decoration:blink; background:white; font-size:13px">* </span>'.$l_content.' :</p>';
		    $body .='<div style="background:#f2f9ff;padding-left:25px;padding-right:25px;padding-top:2px;">'.$nfcontent.'</div>';
		    $body .='<div class="signt">'.$l_sender.' : <i>'.$dfrom.' ('.date("Y-m-d h:i:s").')</i></div>';
		    $body .='<div class="cleart"></div>';
		$body .='</div>';
		$mail->Body = $body;
		$mail->AltBody=$dtitle;
		if(!$mail->Send()) {
			echo  $mail->ErrorInfo;
		} else {
			echo $l_sendmail_ok;
		}
mysql_close($connection);
?>
